﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Assignment3
{
    class Program
    {
        static void Main(string[] args)
        {
            int Num = 0;
            for (int i = 2; i <= 100000; i++)
            {
                for (int j = 2; j <= i; j++)
                {
                    if (i % j == 0 && j != i)
                    {
                        break;
                    }
                    if (i % j == 0 && j == i)
                    {
                        Console.Write(i);
                        Num++;
                        for (int k = 0; k < 6 - i.ToString().Length; k++)
                        {
                            Console.Write(" ");
                        }
                        if (Num % 5 == 0)
                        {
                            Console.WriteLine();
                        }
                    }
                }
            }
            Console.WriteLine();
            Console.Write("100000以内的质数共有{0}个", Num);
            Console.ReadKey();
        }
    }
}
